let axios = require('axios')

const indexController={
    music(req,res){
        axios.get(`https://myhkw.cn/api/web?types=search&count=20&source=netease&pages=${req.query.pages}&name=${encodeURI(req.query.name)}`).then(ress=>{
            let response = {
                code: 0,
                msg: '',
                list:ress.data
            }
            res.json(response)
        })
    },
    musicDetail(req,res){
        axios.get(`https://api.imjad.cn/cloudmusic/?type=song&id=${req.query.id}`).then(ress=>{
            let response = {
                code: 0,
                msg: '',
                list:ress.data
            }
            res.json(response)
        }) 
    },
    oneiromancy(req,res){
        axios.get(`http://v.juhe.cn/dream/query?key=28e10c5147a856faf579738a9d06bc2f&q=${encodeURI(req.query.q)}`).then(ress=>{
            let response = {
                code: 0,
                msg: '',
                list:ress.result
            }
            res.json(response)
        }) 
    },
    constellation(req,res){
        axios.get(`http://web.juhe.cn/constellation/getAll?consName=${encodeURI(req.query.consName)}&type=today&key=dde0217a271c7f33df332d7f57fcaca4`).then(ress=>{
            let response = {
                code: 0,
                msg: '',
                list:ress.result
            }
            res.json(response)
        }) 
    },
    verse(req,res){
        axios.get(`http://poetry.apiopen.top/sentences`).then(ress=>{
            let response = {
                code: 0,
                msg: '',
                list:ress.data.result
            }
            res.json(response)
        }) 
    },
}
module.exports=indexController